package com.demo.commcial.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.demo.commcial.entity.AdminOper;
import com.demo.commcial.entity.AgentBaseInfo;
import com.demo.commcial.service.IAgentBaseInfoService;
import com.demo.commcial.service.impl.AgentBaseInfoServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author admin
 * @since 2020-12-05
 */
@Controller
@RequestMapping("/agentBaseInfo")
public class AgentBaseInfoController {

    @Autowired
    private IAgentBaseInfoService agentBaseInfoService;

    // 查询所有列
    @RequestMapping("list")
    public String list(HttpServletRequest request){

//        List<AdminOper> adminOper = agentBaseInfoService.selectList(null);

        IPage<AgentBaseInfo> agentBaseInfoIPage = this.agentBaseInfoService.getAgentBaseInfoList1(new Page<AgentBaseInfo>(1, 10), "1004","2");

//        System.out.println(agentBaseInfoIPage.getPages());
        System.out.println(agentBaseInfoIPage.getTotal());
        System.out.println(agentBaseInfoIPage.getRecords());

        List<AgentBaseInfo> agentBaseInfoList = agentBaseInfoIPage.getRecords();
//        for(AgentBaseInfo agentBaseInfo: agentBaseInfoList){
//            System.out.println(agentBaseInfo.getCommonInfo().getCodeName());
//        }

        Page<AgentBaseInfo> page = new Page<>(1,10);
        List<AgentBaseInfo> agentBaseInfos = this.agentBaseInfoService.getAgentBaseInfoList(page, "1004", "2");
        System.out.println(agentBaseInfos.size());

        return "list";


    }

}

